import table from '@/components/dt/table/render.js'
import Opt from '@/components/dt/info/Opt.js'
let _this = null
class Column extends Opt {
  constructor(vm) {
    super()
    _this = vm
    this.build()
  }

  build() {
    this.createAll()
    this.opts.push(...this.all)
  }

  createAll() {
    this.all = [
      {
        field: 'nodeOrder',
        title: '流程节点',
        minWidth: 100
      },
      {
        field: 'reviewerMsg',
        title: '审核人',
        minWidth: 150
      },
      {
        field: 'leaderMsg',
        title: '任务责任人',
        minWidth: 150
      },
      {
        field: 'deduct',
        title: '是否扣分节点',
        minWidth: 150,
        slots: {
          default: (params, h) => {
            return [h('div', params.row.deduct == true ? '是' : '否')]
          }
        }
      },
      {
        title: '操作',
        width: 200,
        align: 'center',
        slots: {
          default: (params, h) => {
            let btns = []
            btns.push({
              title:params.row.deduct?'取消扣分节点':'设为扣分节点',
              event:'editNode',
              data: params.row
            })
            return table.cell.btns(_this, h, btns)
          }
        }
      }
    ]
  }
}

export default Column
